package com.shop.controller;

import com.shop.constant.MessageConstant;
import com.shop.entity.Result;
import com.shop.pojo.OrderItem;
import com.shop.service.OrderItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/orderitem")
@Api(tags = "订单商品管理")
public class OrderItemController {
    @Reference
    private OrderItemService orderItemService;

    @PreAuthorize("hasAuthority('QUERY_ORDERITEM')")
    @GetMapping("findAll")
    @ApiOperation("显示订单商品下拉列表接口")
    public Result findAll(@RequestParam(required = true)Integer id){
        List<OrderItem> list=orderItemService.findAll(id);
        return new Result(true,MessageConstant.QUERY_ORDERS_SUCCESS,list);
    }

}
